﻿using System.Linq;
using System.Text;

namespace System.Collections.Generic
{
    /// <summary>
    /// Extensions of IEnumerable<String> 
    /// </summary>
    public static class ArrayOfStringExtensions
    {
        public static string Join(this IEnumerable<String> values, string joinText)
        {
            StringBuilder result = new StringBuilder();

            int cnt = values.Count();

            if (cnt == 0) return string.Empty;

            result.Append(values.ElementAt(0));

            for (int i = 1; i < cnt; i++)
            {
                result.Append(joinText);
                result.Append(values.ElementAt(i));
            }

            return result.ToString();
        }
    }
}
